//  从本地获取数据

/**
 * 根据仓库编码或者名称获取仓库信息
 */
export const DataAnalyze_getStore=(_no)=>{
  let items = window.localStorage.getItem("Store3DData");
  let item = JSON.parse(items);
  for (let i=0;i<item.length;i++){
    let area = item[i];
    for (let j=0;j<area.stores.length;j++){
      let store = area.stores[j];
      if (store.no===_no){
        return store;
      }
    }
  }
  return null;
}

/**
 * 根据组编号或者组名称获取组信息
 */
export const DataAnalyze_getStoreGroup=(_no)=>{
  let items = window.localStorage.getItem("Store3DData");
  let item = JSON.parse(items);
  for (let i=0;i<item.length;i++){
    let area = item[i];
    for (let j=0;j<area.stores.length;j++){
      let store = area.stores[j];
      for (let p=0;p<store.groups.length;p++){
        let group = store.groups[p];
        if (group.no===_no){
          return group;
        }
      }
    }
  }
}

/**
 * 根据库位编码或者库位名称获取库位信息
 */
export const DataAnalyze_getStoreBin=(_no)=>{
  let items = window.localStorage.getItem("Store3DData");
  let item = JSON.parse(items);
  for (let i=0;i<item.length;i++){
    let area = item[i];
    for (let j=0;j<area.stores.length;j++){
      let store = area.stores[j];
      for (let p=0;p<store.groups.length;p++){
        let group = store.groups[p];
        for (let q=0;q<group.bins.length;q++){
          let bin = group.bins[q];
          if (bin.no===_no){
            return bin;
          }
        }
      }
    }
  }
}




